package net.atomtree.corrsepond.template;

import net.atomtree.corrsepond.mode.StageMode;
import net.atomtree.corrsepond.execotor.StageExecutor;

import java.util.Map;

/**
 * Created by czk on 2016/1/2.
 */
public class StageURLTemplate implements URLTemplate {

    @Override
    public String analyse(Map<String, String> URLParam) throws Exception {
        int linkMode=new StageMode().AnalyseMode(URLParam);
        if(linkMode==StageMode.stageMode)
            return new StageExecutor().stagesModeExecutor(URLParam);
        if (linkMode==StageMode.stageIdMode)
            return new StageExecutor().linkByIdModeExecutor(URLParam);
        //StageMode.stageAttemptMode:
        return new StageExecutor().linkByAttemptIdModeExecutor(URLParam);
    }
}